package me.hetong.caigou.ui.stage;

import javafx.scene.layout.HBox;
import me.hetong.caigou.Global;
import me.hetong.caigou.entity.View;
import me.hetong.caigou.ui.ViewFactory;
import me.hetong.caigou.ui.view.Left;
import me.hetong.caigou.ui.view.Right;

/**
 * 启动界面
 */
public class IndexStage {

    public static final View VIEW;

    static {

        HBox hBox = new HBox();

        hBox.getChildren().add(Left.init());
        hBox.getChildren().add(Right.init());

        VIEW = ViewFactory.build(hBox);

        Global.shortcutKeys(VIEW.getScene());
    }

    public static void init() {
        VIEW.getStage().setOnShowing(windowEvent -> {
            LoadingApp.VIEW.getStage().close();
            Left.switchToId("#ip");
        });
        VIEW.getStage().show();
    }
}
